namespace Ray.Web.ViewComponents
{
    using System;
    using Castle.MonoRail.Framework;

    public class StatsComponent : ViewComponent
    {
        private static Random rnd = new Random();
        private string pageName;

        [ViewComponentParam]
        public string PageName
        {
            get { return pageName; }
            set { pageName = value; }
        }

        public override void Render()
        {
            PropertyBag["pagename"] = pageName;

            // Pretend to obtain access count
            PropertyBag["accessCount"] = rnd.Next(1, Int16.MaxValue);

            base.Render();
        }
    }
}
